import os

import uiautomation

from config.config import DATA_PATH
from page.index import IndexPage
from page.药房管理.chufangtuiyao__page import chufangtuiyao
from tools.sjqd_way import read_data_from_excel


class Tiaoshi():
    his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
    his.SetFocus()
    def chufangtuiyao(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        ap = IndexPage()
        cp = chufangtuiyao()
        ap.click_yfgl_btn()#点击药房管理
        ap.click_cfty_btn()#点击处方退药
        cp.input_name(name)
        cp.click_cx_btn()#点击查询按钮
        cp.choose_sj1()#选择数据1
        cp.click_qxbt_btn()#点击全选标头
        cp.click_ty_btn()#点击退药按钮
        cp.click_qd_btn()#点击确定按钮
        cp.click_yes_btn()#点击是否打印处方发药单是按钮
        cp.click_ylgb_btn()#点击预览关闭按钮
if __name__ == '__main__':
    Tiaoshi().chufangtuiyao()

